package com.txx.controller;

import com.txx.pojo.Permission;
import com.txx.service.PermissionService;
import com.txx.vor.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zgc
 * 时间 2021/5/11
 */
@RestController
@CrossOrigin
@RequestMapping("/permission")    //抽取公共的请求
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @GetMapping("/getList")
    public SysResult getList()
    {
        /**
         * URL: /rights/getRightsList
         * 参数: null
         * 类型: get
         * 返回值: SysResult对象 List
         * 业务: 只查询前 2级权限
         */
        List<Permission> permissionList = permissionService.findPermissionList();
        return  SysResult.success(permissionList);
    }
}

